package com.qk.mapper;

import com.qk.entity.Course;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CourseMapper {
@Delete("Delete from course where id = #{id}")
    void deleteById(Integer id);

@Insert("INSERT INTO course(subject, name, price, target, description, create_time, update_time) VALUES(#{subject}, #{name}, #{price}, #{target}, #{description}, #{createTime}, #{updateTime})")
    void insert(Course course);
@Select("Select id, subject, name, price, target, description, create_time, update_time from course where id = #{id}")
    Course getById(Integer id);

    void update(Course course);
@Select("Select id, subject, name, price, target, description, create_time, update_time from course")
    List<Course> listAll();
@Select("Select id, subject, name, price, target, description, create_time, update_time from course where subject = #{subject}")
    List<Course> listBySubject(Integer subject);

        List<Course> listCourses(String name, Integer subject, Integer target);
}









